From 932118bae6edab762999ebe1323acecc177e926a Mon Sep 17 00:00:00 2001 From: robertlipe Date: Thu, 28 Feb 2013 21:48:03 +0000 Subject: [PATCH] Remove dead parse_date function. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4334 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/parse.cc | 54 ----------------------------------------------- 1 file changed, 54 deletions(-) diff --git a/gpsbabel/parse.cc b/gpsbabel/parse.cc index 46807a4f3..3167bdaef 100644 --- a/gpsbabel/parse.cc +++ b/gpsbabel/parse.cc @@ -273,57 +273,3 @@ parse_coordinates(const char *str, int datum, const grid_type grid, return result; } - - -time_t -parse_date(const char *str, const char *format, const char *module) -{ - struct tm tm; - - memset(&tm, 0, sizeof(tm)); - - if (format) { - char *cx = strptime(str, format, &tm); - if ((cx != NULL) && (*cx != '\0')) { - fatal("%s: Could not parse date string (%s).\n", module, str); - } - } else { - int p1, p2, p3, ct; - char sep[2]; - - ct = sscanf(str, "%d%1[-.//]%d%1[-.//]%d", &p1, sep, &p2, sep, &p3); - if (ct != 5) { - fatal("%s: Could not parse date string (%s).\n", module, str); - } - - if ((p1 > 99) || (sep[0] == '-')) { /* Y-M-D (iso like) */ - tm.tm_year = p1; - tm.tm_mon = p2; - tm.tm_mday = p3; - } else if (sep[0] == '.') { /* Germany and any other countries */ - tm.tm_mday = p1; /* have a fixed D.M.Y format */ - tm.tm_mon = p2; - tm.tm_year = p3; - } else { - tm.tm_mday = p2; - tm.tm_mon = p1; - tm.tm_year = p3; - } - if ((p1 < 100) && (p2 < 100) && (p3 < 100)) { - if (tm.tm_year < 70) { - tm.tm_year += 2000; - } else { - tm.tm_year += 1900; - } - } - /* some low-level checks */ - if ((tm.tm_mon > 12) || (tm.tm_mon < 1) || (tm.tm_mday > 31) || (tm.tm_mday < 1)) { - fatal("%s: Could not parse date string (%s).\n", module, str); - } - - tm.tm_year -= 1900; - tm.tm_mon -= 1; - } - - return mkgmtime(&tm); -} -- 2.30.2